﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using WPFSchematics.Definition.Entities;
using System.Windows;
using System.Windows.Media;
using WPFSchematics.Definition.Common;
using System.Windows.Media.Media3D;
using WPFSchematics.Definition.Entities.Collection;
using WPFSchematics.Definition.Layers;
using WPFSchematics.Definition.Shapes;
using WPFSchematics.Definition.FocusFunction;

namespace WPFSchematics.Definition.Views
{
    /// <summary>
    /// 图元视图接口。用于图元呈现及交互。
    /// </summary>
    public interface IShapeView : IEntity
    {
        IFeaturePresenter ControllerPresenter { get; }
        /// <summary>
        /// 
        /// </summary>
        FeaturePresenterCollection FeaturePresenters { get; }
        /// <summary>
        /// 
        /// </summary>
        IFocusFunctionMatrix FocusFunctionMatrix { set; get; }
        /// <summary>
        /// 焦点面板可见性。
        /// </summary>
        bool FocusPanelVisible { set; get; }
        /// <summary>
        /// 标尺可见性。
        /// </summary>
        bool RulerVisible { get; set; }
        /// <summary>
        /// 网格可见性。
        /// </summary>
        bool GridVisible { get; set; }

        /// <summary>
        /// 
        /// </summary>
        bool MagnifierVisible { get; set; }

        /// <summary>
        /// 
        /// </summary>
        IMouseTool CurrentTool { get; }

        ///<summary>
        /// 全局变换矩阵。
        /// </summary>
        Matrix ViewMatrix { set; get; }
        /// <summary>
        /// 视图最小显示单元。
        /// </summary>
        double MinDisplayUint { get; }
        /// <summary>
        /// 视图尺寸。
        /// </summary>
        Rect ViewRect { get; }
        /// <summary>
        /// 缩放限定范围。
        /// </summary>
        ControlRange ScaleRange { set; get; }
        /// <summary>
        /// 图元集合。
        /// </summary>
        IFeatureSet FeatureSet { set; get; }
        /// <summary>
        /// 图层。
        /// </summary>
        DrawingVisual FeaturesVisual { get; }
        /// <summary>
        /// 
        /// </summary>
        DrawingVisual TerminalsVisual { get; }
        /// <summary>
        /// 
        /// </summary>
        DrawingVisual ControllerVisual { get; }
        /// <summary>
        /// 
        /// </summary>
        Visual NetGridVisual { get; }
        /// <summary>
        /// 自定义绘图容器（世界坐标系）。
        /// </summary>
        DrawingVisual CustomWorldVisual { get; }
        /// <summary>
        /// 自定义方向容器（世界坐标系）。
        /// </summary>
        DrawingVisual DirectionWorldVisual { get; }
        /// <summary>
        /// 自定义绘图容器（视图坐标系）。
        /// </summary>
        DrawingVisual CustomViewVisual { get; }
        /// <summary>
        /// 缩放。
        /// </summary>
        /// <param name="centre">中心点。</param>
        /// <param name="deltaScale">缩放增量。</param>
        void Zoom(Point centre,double deltaScale);
        /// <summary>
        /// 放大。
        /// </summary>
        /// <param name="zoomRec"></param>
        void ZoomIn(Rect zoomRec);
        /// <summary>
        /// 缩小。
        /// </summary>
        /// <param name="zoomRec"></param>
        void ZoomOut(Rect zoomRec);
        /// <summary>
        /// 平移。
        /// </summary>
        /// <param name="deltaX">X轴向偏移增量。</param>
        /// <param name="deltaY">Y轴向偏移增量。</param>
        void Span(double deltaX, double deltaY);
        /// <summary>
        /// 坐标点转换（视图-世界）。
        /// </summary>
        /// <param name="point"></param>
        /// <returns></returns>
        Point ViewToWorld(Point point);
        /// <summary>
        /// 坐标点转换（世界-视图）。
        /// </summary>
        /// <param name="point"></param>
        /// <returns></returns>
        Point WorldToView(Point point);
        /// <summary>
        /// 
        /// </summary>
        void Clear();
        /// <summary>
        /// 
        /// </summary>
        void FitView();
        /// <summary>
        /// 
        /// </summary>
        void ResetView();
        /// <summary>
        /// 绑定图元设备。
        /// </summary>
        /// <param name="shapeFeature"></param>
        void BindingShapeFeature(IShapeFeature shapeFeature);
        /// <summary>
        /// 
        /// </summary>
        string CurrentToolIdentifier { get; }
        /// <summary>
        /// 
        /// </summary>
        Action<string> CommandIdentifierAction { get; }
        /// <summary>
        /// 
        /// </summary>
        IShapeView ShapeView { get; }
        /// <summary>
        /// 
        /// </summary>
        InteractiveMode InteractiveMode { get; set; }
        /// <summary>
        /// 
        /// </summary>
        void SetRenderBuffer();
    }

    /// <summary>
    /// 
    /// </summary>
    public enum InteractiveMode
    {
        Readonly,
        Layout,
        Edit
    }
}
